FROM centos:7
RUN yum install -y wget make which lsof openssl git zip unzip yum-utils && cd /usr/local/
# 安装etcd
RUN wget https://github.com/etcd-io/etcd/releases/download/v3.4.13/etcd-v3.4.13-linux-amd64.tar.gz
RUN tar -xvf etcd-v3.4.13-linux-amd64.tar.gz
RUN rm -rf etcd-v3.4.13-linux-amd64.tar.gz
RUN cd etcd-v3.4.13-linux-amd64 && cp -a etcd etcdctl /usr/bin/
# 安装apisix
RUN yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
RUN yum install -y openresty curl git gcc openresty-openssl111-devel
RUN curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash -
RUN yum install -y https://github.com/apache/apisix/releases/download/2.6/apisix-2.6-0.x86_64.rpm
# 安装luarocks
RUN echo -e "LUA_LIB=/usr/local/lib/lua\nexport LUA_LIB" > /etc/profile && source /etc/profile
RUN cd / && wget https://luarocks.org/releases/luarocks-2.4.2.tar.gz && tar -zxvf luarocks-2.4.2.tar.gz && cd luarocks-2.4.2
RUN ./configure --with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1 --with-lua=/usr && make build && make install
RUN rm -rf luarocks-2.4.2*
# 安装luasql-postgres
RUN yum install postgresql-devel Cy && luarocks install luasql-postgres PPGSQL_LIBDIR=/usr/lib PGSQL_INCDIR=/usr/include
ADD postgresql-logger.lua /usr/local/apisix/apisix/plugins
EXPOSE 9080 9090 9443